<include file="Public:header" /> <include file="Public:left" />
<form method="post" enctype="multipart/form-data" >
	<input type="hidden" name="id" />
	<section>	
	<h2><strong>编辑优惠卷</strong>
		<a class="fr" href="{:url('Voucher/lists')}">返回优惠卷列表</a>
	</h2>
	<ul class="ulColumn2">
		<li>
			<span class="item_name" style="width:120px;">优惠卷名称：</span>
			<input type="text" name="name"  class="textbox textbox_295" value='<if condition="$voucher_result">{$voucher_result.name}</if>'/>
		</li>
		<li>
			<span class="item_name" style="width:120px;">满额消费：</span>
            <input type="text" min="0" class="textbox textbox_295" name="fullmoney" value='<if condition="$voucher_result">{$voucher_result.fullmoney}</if>'/>(元)
		</li>
		<li>
			<span class="item_name" style="width:120px;">卷的数量：</span>
            <input type="number" min="0"  class="textbox textbox_295" name="count" value='<if condition="$voucher_result">{$voucher_result.count}</if>'/>
		</li>
		<li>
			<span class="item_name" style="width:120px;">抵扣金额：</span>
            <input type="number" min="0" class="textbox textbox_295" name="deduction" value='<if condition="$voucher_result">{$voucher_result.deduction}</if>'/>(元)
		</li>
		<li>
			<span class="item_name" style="width:120px;">有效天数：</span>
            <input type="number" min="0" class="textbox textbox_295" name="useful_day" value='<if condition="$voucher_result">{$voucher_result.useful_day}</if>'/>
		</li>
		<if condition="$voucher_result">
			<li>
				<span class="item_name" style="width:120px;">优惠卷使用状态：</span>
				<label>
					<input type="radio" name="status"  value='1' <if condition="$voucher_result.status eq 1">checked="checked"</if>>使用
				</label>
				<label>
					<input type="radio" name="status"  value='0' <if condition="$voucher_result.status eq 0">checked="checked"</if>>停用
				</label>
			</li>
		</if>		
		<li>
			<span class="item_name" style="width:120px;"></span>
			<input type="submit" class="link_btn" value="提交" />
		</li>
	</ul>
	</section>
</form>
<script type="text/javascript">
	//检测有效天数
	$(".link_btn").click(function(){
		//检测运费数据是否规范
		var name = $("input[name='name']").val();
		if(name == ''){
			alert('优惠卷名称不能为空');
			return false;
		}

		//满额消费
		var fullmoney = $("input[name='fullmoney']").val();
		if(isNaN(fullmoney) || fullmoney<0){
		  alert("消费钱请填写数字并且大于0");
		  return false;
		}

		//有效天数
		var useful_day = $("input[name='useful_day']").val();
		
		if(useful_day == '0' || useful_day == ''){
			alert("请填写有效天数");
		  	return false;
		}
	});
</script>
</body>

</html>